package com.anandsoftware.negotiator.server.io;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import com.anandsoftware.negotiator.server.ServerContext;

public class Server {

	public void init() {
		if (ServerContext.SERVER_MODE.equalsIgnoreCase("HTTP")) {
			startHttpServer();
		}
	}

	private void startHttpServer() {
		ServerSocket servSocket = null;
		try {
			servSocket = new ServerSocket(ServerContext.PORT);
		} catch (IOException e) {
			System.err.println("IO Exception In starting HTTP Server");
			e.printStackTrace();
		}
		
		if(servSocket != null){
			try {
				Socket socket = servSocket.accept();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
